/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package impss;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author Mikehood
 */
@Entity
@Table(name = "express")
@NamedQueries({@NamedQuery(name = "Express.findAll", query = "SELECT e FROM Express e"), @NamedQuery(name = "Express.findByExpressID", query = "SELECT e FROM Express e WHERE e.expressID = :expressID"), @NamedQuery(name = "Express.findByExpressName", query = "SELECT e FROM Express e WHERE e.expressName = :expressName"), @NamedQuery(name = "Express.findByExpressTime", query = "SELECT e FROM Express e WHERE e.expressTime = :expressTime"), @NamedQuery(name = "Express.findByExpressPrice", query = "SELECT e FROM Express e WHERE e.expressPrice = :expressPrice")})
public class Express implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "expressID")
    private Integer expressID;
    @Column(name = "expressName")
    private String expressName;
    @Column(name = "expressTime")
    private Integer expressTime;
    @Column(name = "expressPrice")
    private Integer expressPrice;
    @OneToMany(mappedBy = "expressID")
    private Collection<Buy> buyCollection;

    public Express() {
    }

    public Express(Integer expressID) {
        this.expressID = expressID;
    }

    public Integer getExpressID() {
        return expressID;
    }

    public void setExpressID(Integer expressID) {
        Integer oldExpressID = this.expressID;
        this.expressID = expressID;
        changeSupport.firePropertyChange("expressID", oldExpressID, expressID);
    }

    public String getExpressName() {
        return expressName;
    }

    public void setExpressName(String expressName) {
        String oldExpressName = this.expressName;
        this.expressName = expressName;
        changeSupport.firePropertyChange("expressName", oldExpressName, expressName);
    }

    public Integer getExpressTime() {
        return expressTime;
    }

    public void setExpressTime(Integer expressTime) {
        Integer oldExpressTime = this.expressTime;
        this.expressTime = expressTime;
        changeSupport.firePropertyChange("expressTime", oldExpressTime, expressTime);
    }

    public Integer getExpressPrice() {
        return expressPrice;
    }

    public void setExpressPrice(Integer expressPrice) {
        Integer oldExpressPrice = this.expressPrice;
        this.expressPrice = expressPrice;
        changeSupport.firePropertyChange("expressPrice", oldExpressPrice, expressPrice);
    }

    public Collection<Buy> getBuyCollection() {
        return buyCollection;
    }

    public void setBuyCollection(Collection<Buy> buyCollection) {
        this.buyCollection = buyCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (expressID != null ? expressID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Express)) {
            return false;
        }
        Express other = (Express) object;
        if ((this.expressID == null && other.expressID != null) || (this.expressID != null && !this.expressID.equals(other.expressID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "impss.Express[expressID=" + expressID + "]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }

}
